﻿@using GTAuto.DAL.DAL
@using GTAuto.DAL.Entities
@using GTAuto.DAL.Enums
@{
    string host = HttpContext.Current.Request.Url.AbsolutePath.ToLower();
}
@if ((host.Contains("brandmodels") || host.Contains("dictionary")) && (!host.Contains("propertydictionary")))
{
    <hr />
    <h3>
        Бренды</h3>
    <ul class="toggle">
        <li class="icn_new_article"><a href="@Url.Content("~/Dictionary/Brands")">Все</a></li>
    </ul>
    @Html.Partial("BrendModelsMenu")
}
@if (host.Contains("propertydictionary") || host.Contains("modificationproperty"))
{
    <hr />
    @Html.Partial("PropertyCategoriesMenu")
}
@if (host.Contains("modelmodifications"))
{

    int itemsCount;
    List<GTBrand> brands = DALBrands.Singleton.GetPaged(BrandTypeEnum.Auto, 1, 10000, out itemsCount);
    
    <hr />
    foreach (var brand in brands)
    {
        var models = DALModels.Singleton.GetByBrand(brand.Id, 1, 10000, out itemsCount);
    <h3>
        @brand.Name</h3>
    <ul class="toggle">
        @foreach (var modl in models)
        {
            <li class="icn_new_article"><a href="@Url.Content(string.Format("~/ModelModifications/ByModel/{0}", modl.Id))">@modl.NameDate</a></li>
        }
    </ul>
    }
}
@if (host.Contains("tiresmodifications"))
{

    int itemsCount;
    List<GTBrand> brands = DALBrands.Singleton.GetPaged(BrandTypeEnum.Tires, 1, 10000, out itemsCount);
    
    <hr />
    foreach (var brand in brands)
    {
        var models = DALModels.Singleton.GetByBrand(brand.Id, 1, 10000, out itemsCount);
    <h3>
        @brand.Name</h3>
    <ul class="toggle">
        @foreach (var modl in models)
        {
            <li class="icn_new_article"><a href="@Url.Content(string.Format("~/tiresmodifications/ByModel/{0}", modl.Id))">@modl.NameDate</a></li>
        }
    </ul>
    }
}
@if (host.Contains("discsmodifications"))
{

    int itemsCount;
    List<GTBrand> brands = DALBrands.Singleton.GetPaged(BrandTypeEnum.Disc, 1, 10000, out itemsCount);
    
    <hr />
    foreach (var brand in brands)
    {
        var models = DALModels.Singleton.GetByBrand(brand.Id, 1, 10000, out itemsCount);
    <h3>
        @brand.Name</h3>
    <ul class="toggle">
        @foreach (var modl in models)
        {
            <li class="icn_new_article"><a href="@Url.Content(string.Format("~/DiscsModifications/ByModel/{0}", modl.Id))">@modl.NameDate</a></li>
        }
    </ul>
    }
}
@if (host.Contains("ads") && !host.Contains("newads") && !host.Contains("adsview") && !host.Contains("activeads") && !host.Contains("noactiveads"))
{
    
    <hr />
   
    <h3>
        Настройки</h3>
    <ul class="toggle">
        <li class="icn_new_article">@Html.ActionLink("Все категории", "Categories", "Ads")</li>
    </ul>
     

    
    <h2>
        Дерево категории</h2>
    
    List<GTAdCategory> gtAdCategories = DALAdCategory.Singleton.GetMainCategories();

    foreach (var cat in gtAdCategories)
    {
    <h3>
        @cat.Name</h3>
        List<GTAdCategory> gtSubAdCategories = DALAdCategory.Singleton.GetByParentID(cat.Id);

    <ul class="toggle">
        @foreach (var temp in gtSubAdCategories)
        {
            <li class="icn_new_article">@Html.ActionLink(temp.Name, "CategoryEdit", "Ads", new { @id = temp.Id }, null)</li>
        }
    </ul>
    }

}
@if (host.Contains("newads") || host.Contains("adsview") || host.Contains("activeads") || host.Contains("noactiveads"))
{
    <hr />
   
    <h3>
        Объявления</h3>
    <ul class="toggle">
        <li class="icn_new_article">@Html.ActionLink("Новые", "NewAds", "Ads")</li>
        <li class="icn_new_article">@Html.ActionLink("Активные", "ActiveAds", "Ads")</li>
        <li class="icn_new_article">@Html.ActionLink("Не активные", "NoActiveAds", "Ads")</li>
    </ul>
}


@if (host.Contains("firms"))
{
    <hr />
   
    <h3>
        Категории фирм</h3>
    <ul class="toggle">
        <li class="icn_new_article">@Html.ActionLink("Все", "Index", "Firms")</li>
    </ul>
    
     <h3>
        Фирмы</h3>
    <ul class="toggle">
        <li class="icn_new_article">@Html.ActionLink("Все", "FirmsAll", "Firms")</li>
    </ul>
}